﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace GH.Web.Welfare
{
    public partial class MutualMemberSumirise : BasePage.PageBase
    {
        public static string UnitRoot = System.Configuration.ConfigurationSettings.AppSettings["UnitRoot"];
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                hddSumarry.Value = "0";
                this.Session["UnionSelect"] = this.Session["Union"].ToString();
                //报表汇总
                if (GetRight(401))
                {
                    hddRights.Value = "1";

                }
                else
                {
                    hddRights.Value = "0";
                }
                //报表查看
                if (GetRight(402))
                {
                    hddOpen.Value = "1";

                }
                else
                {
                    hddOpen.Value = "0";
                }
                DropDownListBind();

            }
            this.hddUnionID.Value = this.Session["UnionSelect"].ToString();
            this.lblUnion.Text = new BLL.Union().GetModel(Convert.ToInt32(this.Session["UnionSelect"])).单位名称;
            this.hddAllName.Value = UnitRoot;

        }

        private void DropDownListBind()
        {
            string strWhere = " 1=1";
            if (hddOpen.Value == "0")
            {
                strWhere = " ID=" + this.Session["Union"].ToString();
            }
            GH.BLL.Union bllUnion = new GH.BLL.Union();

            this.dllUnion.DataSource = bllUnion.GetList(strWhere);
            this.dllUnion.DataTextField = "单位名称";
            this.dllUnion.DataValueField = "ID";
            this.dllUnion.DataBind();

            if (hddOpen.Value == "1")
            {

                this.dllUnion.Items.Insert(0, new ListItem("所有单位", "0"));
            }



        }
    }
}
